import Page
from Page import Motorcade
from Base.Base import Base
from selenium.webdriver.common.by import By


class MotorcadePasswordPage(Base):
    """
    车队口令页面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.password_home_btn = (By.XPATH, Motorcade.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.password_back_btn = (By.XPATH, Motorcade.RESOURCE_ID.format('ivBack'))

        # 你的口令标题
        self.password_car_title_text = (By.XPATH, Motorcade.RESOURCE_ID.format("share_command_title_tv"))

        # 口令数字
        self.password_car_number_text = (By.XPATH, Motorcade.RESOURCE_ID.format("share_command_content_tv"))

        # 进入车队按钮
        self.password_enter_btn = (By.XPATH, Motorcade.RESOURCE_ID.format("enter_home_btn"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.password_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.password_back_btn)

    def get_car_title(self):
        """
        获取车队首页标题

        :return:获取元素
        """
        return self.find_element_o(self.password_car_title_text)

    def get_car_number(self):
        """
        获取车队首页口令

        :return:获取元素
        """
        return self.find_element_o(self.password_car_number_text)

    def click_enter(self):
        """
        点击进入车队按钮

        :return:None
        """
        self.click_element(self.password_enter_btn)

    def is_display_motorcade_details(self):
        """
        是否进入车队详情页

        :return: bool
        """
        return self.is_display(self.password_car_title_text)


if __name__ == '__main__':
    pass
